package common.exception;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * @author 14505
 */
@ControllerAdvice
@Slf4j
public class ExceptionCatch {


    @ExceptionHandler(Exception.class)
    public String exception(Exception e) {
        e.printStackTrace();
        log.error("catch exception:{}", e.getMessage());
        return e.getMessage();
    }

    @ExceptionHandler(CustomException.class)
    public String exception(CustomException e) {
        e.printStackTrace();
        log.error("catch exception:{}", e.getMessage());
        return e.getMessage();
    }
}
